package com.dreamer.service.pyramid;

import com.dreamer.domain.account.AccountsName;
import com.dreamer.domain.pyramid.ParamConfig;
import com.dreamer.repository.account.AccountsNameDAO;
import com.dreamer.repository.pyramid.ParamConfigDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import ps.mx.otter.utils.SearchParameter;

import java.util.List;

@Service
public class AccountsNameHandler {

    @Autowired
    private AccountsNameDAO accountsNameDAO;

    @Transactional
    public AccountsName saveOrupdate(AccountsName paramConfig){
        AccountsName instance = accountsNameDAO.merge(paramConfig);
        return instance;
    }

    @Transactional
    public void remove(AccountsName paramConfig) {
        accountsNameDAO.delete(paramConfig);
    }

    public AccountsName findById(Integer integer) {
        return  accountsNameDAO.findById(integer);
    }

    public List<AccountsName> searchAllByPage(SearchParameter<AccountsName> parameter) {
        return accountsNameDAO.searchAllByPage(parameter);
    }

    public List<AccountsName> findAll(){
        return accountsNameDAO.findAll();
    }

    public List<AccountsName> findByStatusNumber(Integer statusNumber){
        return accountsNameDAO.findByStatusNumber(statusNumber);
    }

}
